class DataCollectionType < ActiveRecord::Base
	has_many :data_collections
  
  @@all_types = {
    :PRE_TREATMENT => "Pre-treatment",
    :FEQ => "Therapeutic alliance",
    :SCAPI1 => "Telephone interview 90",
    :SCAPI2 => "Telephone interview 180",
    :SCAPI3 => "Telephone interview 270",
    :SCAPI4 => "Telephone interview 360",
    :SIX_MONTHS_FOLLOW_UP => "Six-months follow up",
    :ONE_YEAR_FOLLOW_UP => "One-year follow up",
    :TWO_YEAR_FOLLOW_UP => "Two-year follow up"
  }

  def self.all_types
    @@all_types
  end


  # Override
  def to_s
    name
  end


#	def self.get_all_types
#		return [PRE_TREATMENT,
#      ONE_YEAR_FOLLOW_UP,
#      TWO_YEAR_FOLLOW_UP]
#	end
	
	
	def self.get_id(name)
		id = nil
		DataCollectionType.find(:all).each do |t| 
			if (t.name == name)
				id = t.id
			end
		end
		return id
	end
end
